package com.lfk.justweengine.utils.tool;

import com.lfk.justweengine.utils.tools.DisplayUtils;
import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import ohos.app.Context;
import org.junit.Assert;
import org.junit.Test;

public class DisplayUtilsOhosTest {

    @Test
    public void testPx2dip() {
        Context context = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext();
        int num = DisplayUtils.px2dip(context, 2);
        Assert.assertEquals(0, num);
    }

    @Test
    public void testDip2px() {
        Context context = AbilityDelegatorRegistry.getAbilityDelegator().getAppContext();
        int num = DisplayUtils.dip2px(context, 200);
        Assert.assertEquals(96000, num);
    }

    @Test
    public void testTestDip2px() {
        float fa = DisplayUtils.dip2px(200);
        Assert.assertEquals("0.5", Float.toString(fa));
    }
}